import * as THREE from 'three'

import {GLTFLoader} from 'three/examples/jsm/loaders/GLTFLoader.js';
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js'
var r = 'static/model/env/cubemap/'
//The cubemap file urls
var urls = [
  r + 'posx.jpg',
  r + 'negx.jpg',
  r + 'posy.jpg',
  r + 'negy.jpg',
  r + 'posz.jpg',
  r + 'negz.jpg'
]
let mCubeMap = new THREE.CubeTextureLoader().load(urls)
mCubeMap.format = THREE.RGBAFormat
mCubeMap.mapping = THREE.CubeReflectionMapping
export function loaderModel(scene, item) { 
    const loader = new GLTFLoader();
    const dracoLoader = new DRACOLoader();
    dracoLoader.setDecoderPath( 'static/draco/' );
    loader.setDRACOLoader( dracoLoader );
    loader.load(item, (gltf) => { 
        let gltfs = gltf.scene;
        gltfs.traverse(function (child) {
            if (child.isMesh) {

                }
             }
        })
        scene.add(gltfs)
    })
}